home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Plus 1998 #4
/
Amiga Plus CD - 1998 - No. 4.iso
/
pd
/
tools
/
wbstars2.0
/
source
/
wbstars_functions.c
< prev
next >
Wrap
C/C++ Source or Header
|
1997-05-28
|
2KB
|
99 lines
/* $VER: WBStars_functions.c 2.0b4 (28 May 1996)
*/
#include <proto/graphics.h>
#include <proto/layers.h>
#include "WBStars_include.h"
#include "WBStars_protos.h"
#include "WBStars_plot.h"
int SetPixel(int x, int y, char force)
{
ULONG APen; /* because this is not "our" RastPort */
ULONG BPen; /* we have to save the things that we */
ULONG DrMd; /* will change to write the Pixel */
char color;
if(!locked) LockLayerInfo(LInfo);
color=ReadPixel(RPort,x+minx,y+miny);
if( force || color==bg_color )
{
APen = GetAPen(RPort); /* get the Pens and */
BPen = GetBPen(RPort); /* the DrawMode */
DrMd = GetDrMd(RPort);
SetABPenDrMd(RPort, fg_color, BPen, JAM1); /* set our Pens and DrawMode */
WritePixel(RPort,x+minx,y+miny); /* Write our Pixel */
SetABPenDrMd(RPort, APen, BPen, DrMd); /* Reset the Rastport */
if(!locked) UnlockLayerInfo(LInfo);
return (int)color;
}
if(!locked) UnlockLayerInfo(LInfo);
return -1;
}
char ClearPixel(int x, int y, char color)
{
ULONG APen;
ULONG BPen;
ULONG DrMd;
if(!locked) LockLayerInfo(LInfo);
if( ReadPixel(RPort,x+minx,y+miny)==fg_color )
{
APen = GetAPen(RPort);
BPen = GetBPen(RPort);
DrMd = GetDrMd(RPort);
SetABPenDrMd(RPort, color, BPen, JAM1);
WritePixel(RPort,x+minx,y+miny);
SetABPenDrMd(RPort, APen, BPen, DrMd);
if(!locked) UnlockLayerInfo(LInfo);
return TRUE;
}
if(!locked) UnlockLayerInfo(LInfo);
return FALSE;
}
char Test1Pixel(int x, int y)
{
if( ReadPixel(RPort,x+minx,y+miny)==fg_color )
{
return TRUE;
}
return FALSE;
}
void LockPlotArea()
{
if(!locked)
{
LockLayerInfo(LInfo);
locked=TRUE;
}
}
void UnlockPlotArea()
{
if(locked)
{
UnlockLayerInfo(LInfo);
locked=FALSE;
}
}